package com.als.healthymananger.entity;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * <p>
 * 
 * </p>
 *
 * @author aion
 * @since 2021-07-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "users")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户名、登录名，即手机号
     */
    @Schema(description = "用户名、登录名，即手机号")
    @NotNull
    @TableId(value = "username", type = IdType.INPUT)
    private String username;

    /**
     * 真实姓名
     */
    @NotBlank
    @Schema(description = "真实姓名")
    private String name;

    /**
     * 密码
     */
    @NotNull
    @Size(min = 6, max = 26)
    @Schema(description = "密码,由6~26位数字或字母组成")
    private String password;

    /**
     * 用户类型，健康管理员、管理员、会员
     */
    @NotNull
    @Schema(description = "用户类型，健康管理员、管理员、会员", allowableValues = {"master", "mananger", "member"})
    private String type;

    /**
     * 用户登录次数
     */
    @Schema(description = "用户登录次数")
    private Integer count;

    /**
     * 是否启用
     */
    @Schema(description = "是否启用", defaultValue = "是", allowableValues = {"是", "否"})
    private String enable;

    /**
     * 电话
     */
    @Size(min = 11, max = 11)
    @Schema(description = "电话", maxLength = 11, minLength = 11)
    private String phone;

    /**
     * 邮箱
     */
    @Schema(description = "邮箱")
    private String email;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;


}
